package eteam.aps.gateway.filter;

import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.WebFilter;
import org.springframework.web.server.WebFilterChain;
import reactor.core.publisher.Mono;

//@Configuration
public class RequestFilter implements WebFilter {
    @Override
    public Mono<Void> filter(ServerWebExchange serverWebExchange, WebFilterChain webFilterChain) {
        return webFilterChain.filter(serverWebExchange);
        //return webFilterChain.filter(serverWebExchange).subscriberContext((c) -> c.hasKey(CRequestContextHolder.CONTEXT_KEY) ? c : this.withContext(c, serverWebExchange));
    }

    //private Context withContext(Context mainContext, ServerWebExchange exchange) {
    //    return mainContext.putAll(Context.of(CRequestContextHolder.CONTEXT_KEY, exchange.getRequest()));
    //}
}